﻿#pragma once
/**
@author 何炜
@date 2011/5/26
@brief .
@details
*/
#include "GLLSingleton.h"

namespace GLL
{
	class Timer
	{
	public:
		static void Sleep(TimeMS millisec);

		bool setOption( const char* key, const void * val );

		Timer();
		~Timer();

		/** Resets timer */
		void reset();

		/** Returns milliseconds since initialisation or last reset. */
		unsigned long getMilliseconds();

		/** Returns microseconds since initialisation or last reset */
		unsigned long getMicroseconds();

		/** Returns milliseconds since initialisation or last reset, only CPU time measured */	
		unsigned long getMillisecondsCPU();

		/** Returns microseconds since initialisation or last reset, only CPU time measured */	
		unsigned long getMicrosecondsCPU();

#ifdef GLL_WIN
	private:
		clock_t mZeroClock;
		DWORD mStartTick;
		LONGLONG mLastTime;
		LARGE_INTEGER mStartTime;
		LARGE_INTEGER mFrequency;
		DWORD_PTR mTimerMask;
#endif GLL_WIN
	};
};//GLL
